package net.framework.smc.demo.service;

import net.framework.smc.demo.dao.UserJpa;
import net.framework.smc.demo.po.ResultPo;
import net.framework.smc.demo.po.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @authore zyx
 * @date 2018/6/28 11:55
 */
@Service
public class UserService {

    @Autowired
    UserJpa userJpa;

    public ResultPo login(Map<String, String> params) throws Exception{
        User user = userJpa.findByUserName(params.get("userName"));
        String password = user.getPassword();
        if (params.get("password").equals(password)) {
            return ResultPo.success(user);
        } else {
            return ResultPo.error("用户名或密码错误！");
        }

    }
}
